package com.znzx.springboot.controller;

import javax.jws.WebService;
import javax.xml.ws.Endpoint;
import java.io.IOException;
import java.text.SimpleDateFormat;

/**
 * Created by Messi on 2019/11/4.
 */
@WebService
public class TestController {

	private static final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

	public String testWebService (String content) {
		System.out.println("收到了消息"+ content);
		return "服务器:我转发消息给你";
	}

	public static void main(String[] args) throws IOException {

		String address = "http://localhost:8081/znzx/TestController";

		Endpoint.publish(address, new TestController());

		System.out.println("my webservcie starting");

		/*// 智能稽核取值
		Calendar first = Calendar.getInstance();
		first.set(Calendar.DATE, 1);
		first.add(Calendar.MONTH, -5);
		first.set(Calendar.HOUR_OF_DAY, 0);
		first.set(Calendar.MINUTE, 0);
		first.set(Calendar.SECOND, 0);
		Date firstDate = first.getTime();

		Calendar last = Calendar.getInstance();
		// 日期设置为一号
		last.set(Calendar.DATE, 1);
		// 0是本月
		last.add(Calendar.MONTH, 0);
		// 减去一天，变为上月最后一天
		last.add(Calendar.DATE, -1);
		// 小时设置为0
		last.set(Calendar.HOUR_OF_DAY, 0);
		last.set(Calendar.MINUTE, 0);
		last.set(Calendar.SECOND, 0);
		String firstStr= simpleDateFormat.format(first.getTime());
		String lastStr = simpleDateFormat.format(last.getTime());
		Date lastDate = last.getTime();

		String firstTimeStamp = String.valueOf(firstDate.getTime() / 1000);
		String lastTimeStamp = String.valueOf(lastDate.getTime() / 1000);
		System.out.println(firstStr);
		System.out.println(lastStr);
		System.out.println(firstTimeStamp);
		System.out.println(lastTimeStamp);*/


		/*// 读取txt里面的文件并解析JSON
		File file = new File("C:\\Users\\Messi\\Desktop\\json.txt");
		FileInputStream fileInputStream = new FileInputStream(file);
		InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream);
		BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
		StringBuffer sb = new StringBuffer();
		String text = null;
		text = bufferedReader.readLine();
		System.out.println(text);

		List<Map> list = JSON.parseArray(text, Map.class);
		for (Map map : list) {
			System.out.println(map.get("case_no"));
			System.out.println(map.get("y_pred"));
		}*/
	}


}
